var express=require('express');
var app=express();
var route=require('./route');
var expressSession=require('express-session');
app.set('view engine','ejs'); //模板引擎
// 使用session
var hour = 3600000;
app.use(expressSession({
    secret: 'keyboard cat',
    resave: false,
    saveUninitialized: true,
    cookie: {
        expires: new Date(Date.now() + hour),
        maxAge: hour // 失效时间
    }
}))
app.use(express.static('./public'));
app.use('/avatar',express.static('./avatar'));
// 路由表
//首页
app.get('/',route.showIndex);
app.get('/regist',route.regist);
app.post('/doregist',route.doregist);
app.get('/login',route.showLogin);
app.post('/doLogin',route.doLogin);
app.get('/setavatar',route.showSetavatar);
app.post('/dosetavatar',route.dosetavatar);
app.get('/cutpic',route.showcutpic);
app.get('/docut',route.docut);
// 发表说说的路由
app.post('/toshuoshuo',route.doshuoshuo);
app.listen(1111);
